import { createRouter, createWebHistory } from "vue-router";
import {dobreadcurmb} from "@/breadcurmbs";

let Layout = () => import("@/views/layout/Index.vue");
// let Home = () => import('@/views/home/Index.vue')

// let ZhangHao = () => import('@/views/zhanghao/Index.vue')
// let ChanPin = () => import('@/views/chanpin/ChanPin.vue')
// let MiaoSha = () => import('@/views/chanpin/MiaoSha.vue')
// let ShaiXuan = () => import('@/views/chanpin/ShaiXuan.vue')
// let TuiJian = () => import('@/views/chanpin/TuiJian.vue')
// let Echarts = () => import('@/views/echarts/Index.vue')
// let BianJi = () => import('@/views/bianji/Index.vue')
// let Excel = () => import('@/views/excel/Index.vue')
// let Map = () => import('@/views/map/Index.vue')

// let Swipers = () => import('@/views/swipers/Index.vue')
// let AddSwiper = () => import('@/views/swipers/AddSwiper.vue')

let Login = () => import("@/views/login/Index.vue");
let NotFound = () => import("@/views/NotFound.vue");

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/layout",
      name: "layout",
      component: Layout,
      children: [
        {
          id: "1",
          name: "home",
          path: "home",
          component: () => import("@/views/home/Index.vue"),
        },
        // {
        //   path: "home",
        //   component: Home
        // },
        // {
        //   path: "swipers",
        //   component: Swipers,
        // },
        // {
        //   path: 'addswiper',
        //   component: AddSwiper
        // },
        // {
        //   path: "zhanghao",
        //   component: ZhangHao
        // },
        // {
        //   path: "chanpin",
        //   component: ChanPin
        // },
        // {
        //   path: "miaosha",
        //   component: MiaoSha
        // },
        // {
        //   path: "shaixuan",
        //   component: ShaiXuan
        // },
        // {
        //   path: "tuijian",
        //   component: TuiJian
        // },
        // {
        //   path: "echarts",
        //   component: Echarts
        // },
        // {
        //   path: "bianji",
        //   component: BianJi
        // },
        // {
        //   path: "excel",
        //   component: Excel
        // },
        // {
        //   path: "map",
        //   component: Map
        // }
      ],
    },
    // {
    //   path: "/home",
    //   component: Home
    // },
    {
      path: "/login",
      component: Login,
    },
    {
      path: "/:abc(.*)*",
      component: NotFound,
    },
  ],
});

router.beforeEach((to, form, next) => {
  dobreadcurmb(to.path);
  next();
});

export default router;
